package com.yupi.mianshiya.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yupi.mianshiya.model.entity.Comments;
import com.yupi.mianshiya.model.vo.CommentsVO;
import com.yupi.mianshiya.service.CommentsService;
import com.yupi.mianshiya.mapper.CommentsMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;


@Service
public class CommentsServiceImpl extends ServiceImpl<CommentsMapper, Comments>
    implements CommentsService{

    @Override
    public List<CommentsVO> convertCommentsToVO(List<Comments> commentsList) {
        if (CollUtil.isEmpty(commentsList)){
            return null;
        }
        List<CommentsVO> CommentsVOList = commentsList.stream().map(CommentsVO::objToVo).collect(Collectors.toList());
        return CommentsVOList;
    }
}




